import Vue from 'vue'
import App from './App.vue'
import router from './router'
import './assets/css/global.css'
import './assets/fonts/iconfont.css'
import treeTable from 'vue-table-with-tree-grid'

import ElementUI from 'element-ui'
import 'element-ui/lib/theme-chalk/index.css'
import VueQuillEditor from 'vue-quill-editor'

import 'quill/dist/quill.core.css' // import styles
import 'quill/dist/quill.snow.css' // for snow theme
import 'quill/dist/quill.bubble.css'

import axios from 'axios' // for bubble theme

Vue.use(VueQuillEditor/* { default global options } */)
// 引入时间文件
var moment = require('moment')
// 导入一个表格;不晓得是啥子  安装名叫:vue-table-with
Vue.component('tree-table', treeTable)
// 挂载默认值
axios.defaults.baseURL = 'http://127.0.0.1:8888/api/private/v1/'
// 添加请求拦截器
axios.interceptors.request.use(config => {
  // 在发送请求之前做些什么
  config.headers.Authorization = window.sessionStorage.getItem('token')
  return config
}, error => {
// 对请求错误做些什么
  return Promise.reject(error)
})
Vue.prototype.$http = axios

// 时间解析管涵
Vue.filter('dataForm', item => {
  return moment.unix(item).format('YYYY-MM-DD HH:mm:ss')
})
Vue.use(ElementUI)

Vue.config.productionTip = false

new Vue({
  router,
  render: h => h(App)
}).$mount('#app')
